﻿using math.DTOs;
using math.Views;
namespace math.Controllers
{
    public class ArithController
    {
        private IArith _view;
        public ArithController(IArith view)
        {
            if (view != null)
                _view = view;
        }
        public void HandleFactorial()
        {
            int n = _view.InputNumber;
            long fact = 1;
            while (n >= 1)
            {
                fact = fact * n;
                n--;
            }
            FactorialInfo factorialInfo =new FactorialInfo();
            factorialInfo.No = _view.InputNumber;
            factorialInfo.Fact = fact;

            _view.Result = factorialInfo;
        }
    }
}
